import {createRouter, createWebHashHistory} from 'vue-router'
const routes = [
    {
        path: "/",
        component: () => import("@/layout/index.vue"),
        redirect: "/home",
        children: [
            {
                path: "/home",
                name: "home",
                icon: "",
                meta: {
                    title: '首页'
                },
                component: () => import("@/views/homes/index.vue")
            },
            {
                path: "/departmentManage",
                name: "departmentManage",
                icon: "",
                meta: {
                    title: '部门管理'
                },
                component: () => import(/* webpackChunkName: "departmentManage" */"@/views/organization/department/index.vue")
            },
            {
                path: "/userManage",
                name: "userManage",
                icon: "",
                meta: {
                    title: '用户管理'
                },
                component: () => import(/* webpackChunkName: "userManage" */"@/views/organization/user/index.vue")
            },
            {
                path: "/roleManage",
                name: "roleManage",
                icon: "",
                meta: {
                    title: '角色管理'
                },
                component: () => import(/* webpackChunkName: "roleManage" */"@/views/organization/role/index.vue")
            },
            {
                path: '/profile',
                name: 'profile',
                meta: {
                    title: '个人中心'
                },
                component: () => import(/* webpackChunkName: "profile" */ '../views/personal/index.vue')
            }
      
        ] 
    },
    
    {
        path: '/error/403',
        name: '403',
        meta: {
            title: '没有权限'
        },
        component: () => import(/* webpackChunkName: "403" */ '../views/error/403.vue')
    },
    {
        path: '/error/404',
        name: '404',
        meta: {
            title: '找不到页面'
        },
        component: () => import(/* webpackChunkName: "404" */ '../views/error/404.vue')
    },
    {
        path: '/error/500',
        name: '500',
        meta: {
            title: '服务器错误'
        },
        component: () => import(/* webpackChunkName: "500" */ '../views/error/500.vue')
    },
    {
        path: "/login",
        name: "login",
        component: () => import("@/views/login/index.vue")
    // component: () => import(/* webpackChunkName: "login" */"@/views/login/index.vue")
    },
    //404 异常路由
    {
        path: '/:catchAll(.*)',
        ame: 'error404',
        redirect: '/error/404'
    }
]
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
export default router